import request from '@/config/axios'

// 套餐 VO
export interface PackageVO {
  id: number // 套餐编号
  status: number // 状态
  packageType: boolean // 套餐类型
  packageName: string // 套餐名称
  originalPrice: number // 原价格
  salePrice: number // 售卖价格
  points: number // 积分
  writtenExamQuestionPrice: number // 笔试题单价
  writtenExamQuestionCount: number // 包含笔试试题量
  writtenExamDuration: number // 笔试时长
  voiceReportAnswerEnable: boolean // 语音播报答案
  customerService: boolean // 客服服务
  remoteTeachEnable: boolean // 远程教学
}

// 套餐 API
export const PackageApi = {
  // 查询套餐分页
  getPackagePage: async (params: any) => {
    return await request.get({ url: `/pay/package/page`, params })
  },

  // 查询套餐详情
  getPackage: async (id: number) => {
    return await request.get({ url: `/pay/package/get?id=` + id })
  },

  // 新增套餐
  createPackage: async (data: PackageVO) => {
    return await request.post({ url: `/pay/package/create`, data })
  },

  // 修改套餐
  updatePackage: async (data: PackageVO) => {
    return await request.put({ url: `/pay/package/update`, data })
  },

  // 删除套餐
  deletePackage: async (id: number) => {
    return await request.delete({ url: `/pay/package/delete?id=` + id })
  },

  // 导出套餐 Excel
  exportPackage: async (params) => {
    return await request.download({ url: `/pay/package/export-excel`, params })
  }
}